<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>打飞机</title>
  <script src="js/background.js"></script>
</head>
<body onload="drawPlane()" style="padding: 0;margin: 0;text-align: center;">
  <canvas id="canvas" width="320" height="568"></canvas>
<script>
  function drawPlane(){
    let bgCanvas = document.querySelector("#canvas");
    if(bgCanvas.getContext){
      let bgURL = 'img/bg.png';
      loadBg(bgURL,bgCanvas,moveBg);
      function moveBg(img){
        let speed = 5;
        setInterval(function(){
          bgMove(bgCanvas,img,speed)
        },30)
      }
    }
  }
</script>
</body>
</html>